#
# Makefile for bison/flex
#
# BISON_FLAGS:
#	-d: Erstellelt Header-File ${BISON_NAME}.h mit den Makro-Definitionen,
#       der in ${BISON_NAME}.y angegebenen Token. Dies ist notwendig,
#       damit ${FLEX_NAME}.l diese inkludieren und in den dort definnierten
#       Regeln returnen kann
#
#   -v: Erstellt Output-File ${BISON_NAME.output}
#
BISON_FLAGS = -d -v
FLEX_FLAGS  =
GCC_FLAGS   = -O2 -Wall -pedantic -ansi
LIBS        = -lfl
TARGET	    = flexer
FLEX_NAME   = flexer
BISON_NAME  = parser


main: ${FLEX_NAME} ${BISON_NAME}
	g++ $(GCC_FLAGS) ${BISON_NAME}.c -o $(TARGET)

${FLEX_NAME}:
	flex $(FLEX_FLAGS) -o ${FLEX_NAME}.c ${FLEX_NAME}.l 

${BISON_NAME}:
	bison $(BISON_FLAGS) -o ${BISON_NAME}.c ${BISON_NAME}.y

clean:
	rm -f $(TARGET) ${BISON_NAME}.c ${FLEX_NAME}.c ${BISON_NAME}.output ${BISON_NAME}.h